//
//  LoginDetailViewController.m
//  A段项目音乐播放
//
//  Created by dllo on 15/5/22.
//  Copyright (c) 2015年 lanou3g.com蓝鸥科技. All rights reserved.
//

#import "LoginDetailViewController.h"
#import "SignViewController.h"
#import "Singleton.h"
#import "LTView.h"
@interface LoginDetailViewController ()<UITextFieldDelegate>

@end

@implementation LoginDetailViewController

- (void)dealloc
{
    [super dealloc];
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}

-(void)loadView
{
    [super loadView];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self create];
}


- (void)create
{
    UIImageView *viewHead = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 120, 120)];
    viewHead.image = [UIImage imageNamed:@"1.jpg"];
    [viewHead.layer setCornerRadius:60];
    [viewHead.layer setMasksToBounds:YES];
    [self.view addSubview:viewHead];
    
    
//    UILabel *labelName = [[UILabel alloc]initWithFrame:CGRectMake(50, 300, 100, 30)];
//    labelName.text = @"用户名";
//    [labelName setTextColor:[UIColor blackColor]];
//    [self.view addSubview:labelName];
//    
//    UILabel *labelPwd = [[UILabel alloc]initWithFrame:CGRectMake(50, 360, 100, 30)];
//    labelPwd.text = @"密码";
//    [labelPwd setTextColor:[UIColor blackColor]];
//    [self.view addSubview:labelPwd];
//    
//    
//    UITextField *fieldName = [[UITextField alloc]initWithFrame:CGRectMake(160, 300, 150, 30)];
//    fieldName.placeholder = @"请输入用户名";
//    fieldName.borderStyle = UITextBorderStyleRoundedRect;
//    fieldName.textAlignment = NSTextAlignmentLeft;
//    fieldName.delegate = self;
//    fieldName.clearButtonMode = UITextFieldViewModeWhileEditing;
//    [self.view addSubview:fieldName];
//    
//    
//    UITextField *fieldPwd = [[UITextField alloc]initWithFrame:CGRectMake(160, 360, 150, 30)];
//    fieldPwd.placeholder = @"请输入密码";
//    fieldPwd.borderStyle = UITextBorderStyleRoundedRect;
//    fieldPwd.textAlignment =  NSTextAlignmentLeft;
//    fieldPwd.delegate = self;
//    fieldPwd.clearButtonMode = UITextFieldViewModeWhileEditing;
//    fieldPwd.secureTextEntry = YES;
//    [self.view addSubview:fieldPwd];
    
    LTView *view1 = [[LTView alloc]initWithFrame:CGRectMake(50, 300, 320, 30)];
    [self.view addSubview:view1];
    view1.mylabel.text = @"用户名";
    view1.myField.placeholder = @"请输入用户名";
    view1.tag = 1;
    view1.myField.borderStyle = UITextBorderStyleRoundedRect;
    [view1 release];
    
    LTView *view2 = [[LTView alloc]initWithFrame:CGRectMake(50, 360, 320, 30)];
    [self.view addSubview:view2];
    view2.mylabel.text = @"密码";
    view2.myField.placeholder = @"请输入密码";
    view2.myField.secureTextEntry = YES;
    view2.tag = 2;
    view2.myField.borderStyle = UITextBorderStyleRoundedRect;
    [view2 release];
    
    
    
    UIButton *buttonSign = [[UIButton alloc]initWithFrame:CGRectMake(30, 400, 80, 30)];

    [buttonSign setBackgroundColor:[UIColor colorWithRed:0.35 green:1 blue:1 alpha:1]];
    [buttonSign setTitle:@"注册" forState:UIControlStateNormal];
    [buttonSign setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    buttonSign.layer.borderWidth = 1;
    buttonSign.layer.borderColor = [UIColor whiteColor].CGColor;
    buttonSign.layer.cornerRadius = 15;
    [buttonSign addTarget:self action:@selector(buttonSignAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:buttonSign];
//    [self.view setBackgroundColor:[UIColor blackColor]];
    
    UIButton *buttonSure = [[UIButton alloc]initWithFrame:CGRectMake(150, 400, 80, 30)];
    [buttonSure setTitle:@"确定" forState:UIControlStateNormal];
    [buttonSure setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [buttonSure setBackgroundColor:[UIColor colorWithRed:0.35 green:1 blue:1 alpha:1]];
    buttonSure.layer.borderColor = [UIColor whiteColor].CGColor;     // 边框颜色
    buttonSure.layer.borderWidth = 2;            // 边框宽度
    buttonSure.layer.cornerRadius = 15;
    [buttonSure addTarget:self action:@selector(buttonSure:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:buttonSure];

    UIButton *buttonBack = [[UIButton alloc]initWithFrame:CGRectMake(260, 400, 80, 30)];
    [buttonBack setTitle:@"返回" forState:UIControlStateNormal];
    [buttonBack setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [buttonBack setBackgroundColor:[UIColor colorWithRed:0.35 green:1 blue:1 alpha:1]];
    buttonBack.layer.borderWidth = 2;
    buttonBack.layer.borderColor = [UIColor whiteColor].CGColor;
    buttonBack.layer.cornerRadius = 15;
    [buttonBack addTarget:self action:@selector(buttonBack:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:buttonBack];
    
}


//- (BOOL)textFieldShouldReturn:(UITextField *)textField
//{
//    [textField resignFirstResponder];
//    return YES;
//}

// 点击空白处 收回键盘
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}


- (void)buttonSignAction:(id)sender
{
    SignViewController *sign = [[SignViewController alloc]init];
    UINavigationController *sign1 = [[UINavigationController alloc]initWithRootViewController:sign];
    [self.navigationController presentViewController:sign1 animated:YES completion:nil];
    
}

- (void)buttonBack:(id)sender
{
    
    [self.navigationController popViewControllerAnimated:YES];
}


- (void)buttonSure:(id)sender
{
    Singleton *sing = [Singleton shareManager];
    if (sing.login == YES) {
        NSLog(@"已登录");
    }else{
        NSLog(@"未登录");
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
